<template>
    <div ref="vmGPUPart">
        <div class="tableCon" style="height:230px">
            <ics-el-table ref="gpuTable"
                v-validate-easy="rules.table"
                name="gpuTable"
                data-type="dataGrid"
                :config="gpuTableConfig"
                :localData="gpuTableConfig.localTableData"
                @selectRow="selectRow"
                @loadComplete="loadComplete">
            </ics-el-table>
        </div>
        <el-divider></el-divider>
        <div id="gpuContent">
            <gpuItem ref="gpuCon" v-model="gpu" v-if="gpu" :deviceData="deviceData" :gpus="gpus">
            </gpuItem>
        </div>
    </div>
</template>
<script>
export default {
    name: 'gpu',
    // component: {gpuItem},
    props: ['options'],
    data() {
        return {
            ref: 'vmGPUPart',
            gpuTableConfig: {
                localTableData: [],
                mode: 'local',
                showRadio: true,
                columns: [
                    {
                        name: 'id',
                        index: 'id',
                        hidden: true
                    },
                    {
                        name: 'GPU序号',
                        index: 'gpuIndex'
                    },
                    {
                        name: 'GPU名称',
                        index: 'name'
                    },
                    {
                        name: '设备型号',
                        index: 'boundGPUProductName'
                    },
                    {
                        name: '使用方式',
                        index: 'gpuGroupType'
                    }
                ],
                beforeSelect: this.beforeSelect
            },
            gpus: this.$attrs.vmData.gpus ? this.$attrs.vmData.gpus : [],
            deviceData: [],
            hasGet: false,
            gpu: null,
            activeIndex: 0,
            gpuIndex: 1,
            defaultGpu: {
                gpuGroup: {
                    name: '',
                    groupType: '',
                    id: ''
                }
            },
            rules: {
                table: [
                    ['required', '该输入项不能为空']
                ]
            }
        }
    },
    beforeMount() {

    }
}
</script>
